package com.hhd.flow.engine.cmd.impl;

import com.hhd.flow.engine.cmd.CommandResult;
import com.hhd.flow.exception.FlowException;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class DefaultCommandResult<T> implements CommandResult<T> {
    public T data;

    public static <T> CommandResult<T> forResult(T data) {
        DefaultCommandResult<T> defaultCommandResult = new DefaultCommandResult<>();
        defaultCommandResult.setData(data);
        return defaultCommandResult;
    }

    @Override
    public T getResult() throws FlowException {
        return data;
    }
}
